package blackhouse_dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import blackhouse_entity.classtable;

public class classtableDao extends jdbc_dao
{
	public List<classtable> findClassInfo(String sql) throws SQLException
	{

		ResultSet rs = query(sql);
		List<classtable> list = new ArrayList<classtable>();
		while (rs.next())
		{
			classtable obj = new classtable();
			obj.setId(rs.getInt("id"));
			obj.setClassName(rs.getString("className"));
			obj.setClassCode(rs.getString("classCode"));
			obj.setClassMessage(rs.getString("createMessage"));
			obj.setCreateTime(rs.getString("createTime"));
			obj.setGradeid(rs.getInt("gradeID"));
			obj.setGradename(rs.getString("gradeName"));
			list.add(obj);
		}
		close(conn, st, rs);
		return list;
	}

	public int deldao(String sql)
	{
		return update(sql);
	}

	public List<classtable> findClassInfo2(String sql) throws SQLException
	{

		ResultSet rs = query(sql);
		List<classtable> list = new ArrayList<classtable>();
		while (rs.next())
		{
			classtable obj = new classtable();
			obj.setId(rs.getInt("id"));
			obj.setClassName(rs.getString("className"));
			obj.setClassCode(rs.getString("classCode"));
			obj.setClassMessage(rs.getString("createMessage"));
			obj.setCreateTime(rs.getString("createTime"));
			obj.setGradeid(rs.getInt("gradeID"));
			obj.setGradename(rs.getString("gradeName"));
			list.add(obj);
		}
		close(conn, st, rs);
		return list;
	}

	public int addclass(String sql)
	{
		return update(sql);
	}
}
